package xing.domain.page;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.sql.Timestamp;

@Entity
@Table(name="page_module_item")
public class PageModuleItem implements Comparable<PageModuleItem> ,Serializable {
  private Long id;
  private Long moduleid;
  private Long contentid;
  private Integer reftype;  //0:企业内容     1:官方内容
  private Long sort;
  private String companycode;
  private Timestamp created;

  public PageModuleItem(){}

  public PageModuleItem(long id, long moduleid,long contentid,Integer reftype, long sort,String companycode,Timestamp created){
    this.id=id;
    this.moduleid=moduleid;
    this.contentid=contentid;
    this.reftype=reftype;
    this.sort=sort;
    this.companycode=companycode;
    this.created=created;
  }

  private Set<PageModuleItem> moduleItems=new HashSet<>();
  @Transient
  public Set<PageModuleItem> getModuleItems() {
    return moduleItems;
  }

  public void setModules(Set<PageModuleItem> moduleItems) {
    this.moduleItems = moduleItems;
  }
  @Id
  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public Long getContentid() {
    return contentid;
  }

  public void setContentid(Long contentid) {
    this.contentid = contentid;
  }

  public Integer getReftype() {
    return reftype;
  }

  public void setReftype(Integer reftype) {
    this.reftype = reftype;
  }

  public Long getModuleid() {
    return moduleid;
  }

  public void setModuleid(Long moduleid) {
    this.moduleid = moduleid;
  }

  public Long getSort() {
    return sort;
  }

  public void setSort(Long sort) {
    this.sort = sort;
  }

  public String getCompanycode() {
    return companycode;
  }

  public void setCompanycode(String companycode) {
    this.companycode = companycode;
  }

  public java.sql.Timestamp getCreated() {
    return created;
  }

  public void setCreated(java.sql.Timestamp created) {
    this.created = created;
  }

  @Override
  public int compareTo(PageModuleItem o) {
    return this.sort.compareTo(o.sort);
  }
}
